<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1,maximum-scale=1">
	<title>注册页面</title>
	<link rel="stylesheet" type="text/css" href="/pxm/css/common.css">
	<link rel="stylesheet" type="text/css" href="/pxm/css/login.css">
</head>
<body>
</div>
	<div class="login_cont">
		<div class="login_nav">
			<div class="nav_slider">
                <a href="/login" class="signin">登录</a>
				<a href="/register" class="signup focus">注册</a>
			</div>
		</div>
		<form action="" method="post" id="rows">
			<div class="input_signup active">
                {{csrf_field()}}
                <input class="input" name="uname" type="text" placeholder="用户名">
				<div class="hint"></div>
				<input class="input" name="utel" type="text" placeholder="手机号（仅支持中国大陆）">
				<div class="hint"></div>
				<input class="input" name="upassword" type="password" placeholder="密码（不少于 6 位）">
				<div class="hint"></div>
				<input class="input" name="repassword" type="password" placeholder="再次输入密码">
				<div class="hint"></div>
				<input class="submit" type="button" value="注册">
			</div>
		</form>
</body>
</html>
<script src="/pxm/css/jquery-1.4.4.js"></script>
<script>
    $(".submit").click(function(){
        var formData=$("#rows").serialize();
        $.ajax({
            type:"post",
            url:'/register_ok',
            data:formData,
            success:function(data){
                alert(data['name']);
                if(data['code']==1){
                    location.href=data['url'];
                }
            },
            error : function (msg ) {
                var json = JSON.parse(msg.responseText);
                $.each(json.errors, function (idx, obj) {
                    alert(obj[0]);
                    return false;
                });
            }
        });
    });
</script>
